<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <meta name = "format-detection" content = "telephone=no">
    <title>订单结算</title>
    <link rel="stylesheet" href="/Public/Home/css/cart.css?v=20170411001">
    <!--不识别数字为手机-->
<meta name="format-detection" content="telephone=no, email=no"/>
<!--通用js-->
<?php if(isset($signPackage) && !empty($signPackage)){ ?>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js?v=201704270010"></script>
<?php } ?>
<script type="text/javascript" src="/Public/Home/js/require.js"></script>
<script type="text/javascript" src="/Public/Home/js/baseLoading.js?v=201705240001"></script>
<script src="/Public/Home/js/jquery.min.js" ></script>
<script src="/Public/Home/js/pincode-input.js" ></script>
<script src="/Public/Home/js/parabola.js" ></script>
<script src="/Public/Home/js/lazyload/jquery.lazyload.min.js"></script>
<script type="text/javascript">
    _global.isLogin = !!"<?php echo $wx_member_id; ?>";
	var isWxShareDiy = typeof yc_share_diy === "undefined" ? false : yc_share_diy;
	var yc_wx_shareImgPath = "";
	<?php if(isset($weixin_logo) && !empty($weixin_logo)){ ?>
		yc_wx_shareImgPath = "/Uploads/<?php echo ($weixin_logo["image"]); ?>";
	<?php } ?>
    var yc_pass_arr = {'local_id':"<?php echo I('local_id',1);?>",'top_local_id':"<?php echo I('top_local_id',1);?>"};
	if(parseInt(yc_pass_arr["local_id"]) == 21){
		_global.isStopSell = true;
	}
    <?php if(isset($signPackage) && !empty($signPackage)){ ?>
        _global.isWeiXinLoad = true;
        var isEnableLocation = typeof yc_wx_location === "undefined" ? false : yc_wx_location;
        var yc_wx_options = {
            "enableLocation" : isEnableLocation,
            "refuseCallback" : function(){},
            "mapCallback" : function(){},
            "config" : {
                debug: false,
                appId: '<?php echo $signPackage["appId"];?>',
                timestamp: '<?php echo $signPackage["timestamp"];?>',
                nonceStr: '<?php echo $signPackage["nonceStr"];?>',
                signature: '<?php echo $signPackage["signature"];?>',
                jsApiList: [
                    'checkJsApi'
                ]
            }
        };
        var isInHeader = typeof yc_wx_useInHeader === "undefined" ? true : yc_wx_useInHeader;
        if(isInHeader){
            wxAutoConfig(yc_wx_options);
        }
    <?php } ?>
</script>
    <script>
        window.localStorage.setItem('isThrough',null);
    </script>
</head>
<body>
<div class="warp" style="padding-bottom:1.1rem;">

    <!-- 配送地址 -->
    <div class="address">
        <div class="address-list">
            <!-- 有地址 -->
            <div class="address-item">
                <h3>收货人：<span id="receipt"><?php echo ($addr["name"]); ?></span><span id="mobile"><?php echo ($addr["mobile"]); ?></span></h3>
                <h4>收货地址:<span id="addrpriv"><?php echo ($addr["area"]); ?></span><span id="adddetaile"><?php echo ($addr["addr"]); ?></span></h4>
            </div>
        </div>
    </div>
    <!-- 订单包 -->
    <?php if(is_array($checkout)): $k = 0; $__LIST__ = $checkout;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$orderItem): $mod = ($k % 2 );++$k; if($orderItem['checked_num'] != 0): if($orderItem['is_self'] != 1): ?><div class="order-package mgTop" data-total="<?php echo (number_format($orderItem['local_total'], 2, '.', '')); ?>" data-fee="<?php echo ($orderItem['ship_fee']); ?>" data-free="<?php echo ($orderItem['free']); ?>" data-dkPrice="<?php echo (number_format($orderItem['bonus_money'], 2, '.', '')); ?>">
        <?php if(!empty($orderItem['coupon'])): ?><div style="display: none" class="coupondis">
            <?php if(is_array($orderItem['coupon'])): $i = 0; $__LIST__ = $orderItem['coupon'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$orderCoupon): $mod = ($i % 2 );++$i; if($orderCoupon['Is_use'] == 1): ?><li  data-id="<?php echo ($orderCoupon['code']); ?>"  data-lid="<?php echo ($orderCoupon['local_id']); ?>" data-money="<?php echo ($orderCoupon['discmoney']); ?>" data-tomoney="<?php echo ($orderCoupon['to_money']); ?>" data-did="<?php echo ($orderCoupon['id']); ?>"><?php echo ($orderCoupon['name']); ?></li><?php endif; endforeach; endif; else: echo "" ;endif; ?>
        </div><?php endif; ?>
        <div class="package-name clearfix" data-lid="<?php echo ($orderItem['local_id']); ?>" data-m="<?php echo ($orderItem['mobile']); ?>">
            <h3 class="fl">包裹<?php echo ($orderItem['inum']); ?></h3>
            <h5 class="fr"><?php echo ($orderItem['local_name']); ?></h5>
        </div>
        <ul>
            <li>

               <?php if(is_array($orderItem["products"])): $i = 0; $__LIST__ = $orderItem["products"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$item): $mod = ($i % 2 );++$i; if($item['type'] != 1 and $item['ischeck'] == 1 and $item['active'] == 1): ?><div class="goods-item clearfix" data-type="<?php echo ($item['type']); ?>" data-pid="<?php echo ($item['product_id']); ?>" data-lid="<?php echo ($item['local_id']); ?>">
                    <div class="img"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="<?php echo (getthumb($item["goods_id"])); ?>"></div>
                    <div class="goods-text">
                        <p class="name text-hide"><?php echo ($item['name']); ?></p>
                        <p class="norms"><?php echo ($item['spec_info']); ?></p>
                        <p class="price clearfix">
                            <span class="fl"><label>￥</label>
                                <!--id="data_price"-->
   <label class="data_price" style="color: #da3558;"><?php echo (number_format($item['final_price'], 2, '.', '')); ?></label>
                                <!--<label>￥<?php echo (number_format($item['marketprice'], 2, '.', '')); ?></label>-->
                                <label></label>
                            </span>
                            <span class="fr"><?php echo ($item['cart_num']); ?></span>
                        </p>
                    </div>
                </div>
                 <?php else: ?>
                    <?php if(is_array($item["group_products"])): $i = 0; $__LIST__ = $item["group_products"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$gitem): $mod = ($i % 2 );++$i; if($item['active'] == 1 and $item['ischeck'] == 1): ?><div class="goods-item clearfix  group" data-gid="<?php echo ($item['group_id']); ?>" data-type="<?php echo ($item['type']); ?>" data-pid="<?php echo ($gitem['product_id']); ?>"
                             data-lid="<?php echo ($item['local_id']); ?>">
                           <div class="img"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="<?php echo (getthumb($gitem["goods_id"])); ?>"></div>
                           <div class="goods-text">
                               <p class="name text-hide"><?php echo ($gitem['product_name']); ?></p>
                               <!--id="is_spec_info"-->
                               <p class="norms"  class="is_spec_info"><?php echo ($gitem['spec_info']); ?></p>
                               <!--id="pack_id"-->

                               <p class="price clearfix">
                                   <!--id="data_price"-->
                                   <span  class="pack_id" style="color: #ff2e49; font-size: 0.26rem"><?php echo ($gitem['name']); ?> 总价：<?php echo (number_format($gitem['total_price'], 2, '.', '')); ?></span>
                                   <span class="fr"><?php echo ($gitem['num']); ?></span>
                               </p>
                           </div>
                       </div><?php endif; endforeach; endif; else: echo "" ;endif; endif; endforeach; endif; else: echo "" ;endif; ?>

            </li>



            <?php if($orderItem['tc_num'] != ''): ?><li class="message">
                    <p class="fl">套餐数量</p>
                    <p class="fr"><?php echo ($orderItem['tc_num']); ?>套</p>
                </li><?php endif; ?>


            <li class="delivery">
                <p class="fl">配送方式</p>
                <?php if($orderItem['shipping'] == 1): ?><p class="fr logistic-method" data-id="<?php echo ($orderItem['shipping']); ?>">送货上门</p>
                    <p class="fr expect-time"><?php echo ($orderItem['expected_time']); ?></p>
                 <?php elseif($orderItem["shipping"] == 2): ?>
                    <p class="fr logistic-method" data-id="<?php echo ($orderItem['shipping']); ?>">自提</p>
                    <p class="fr expect-time"><?php echo ($orderItem['expected_time']); ?></p>
                    <p class="clearfix"></p>
                    <p class="zt-address" style="display:block">自提地址：<?php echo ($orderItem['zT_addr']); ?></p><?php endif; ?>


            </li>





            <?php if(!empty($orderItem['coupon'])): ?><li class="coupon-use clearfix">
                <h3>使用礼券</h3>
                <a href="javascript:void(0);">请选择</a>
            </li><?php endif; ?>

            <?php if(!empty($orderItem['order_pro'])): ?><!-- 促销方式 -->
            <li class="message" style="line-height: inherit;">
                <p class="fl">促销方式</p>
                <p class="fr">
                    <?php if(is_array($orderItem['order_pro'])): $i = 0; $__LIST__ = $orderItem['order_pro'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$order_pro): $mod = ($i % 2 );++$i;?><span class="red"><?php echo ($order_pro['name']); ?></span>
                        <br style="height: 1px"><?php endforeach; endif; else: echo "" ;endif; ?>
                </p>
            </li><?php endif; ?>


            <?php if($orderItem['bonus_money'] > 0): ?><li class="deduct-use">
                可用<?php echo ($orderItem['bonus_money']); ?>奖金抵扣<?php echo (number_format($orderItem['bonus_money'], 2, '.', '')); ?>元
            </li><?php endif; ?>

            <li class="message">
                <!--id="msg"-->
                <p class="fl">备注留言</p><p class="fr"><input type="text"  class="package-msg" value="" placeholder="选填:对本次交易的说明(建议写清楚自己的.....)"></p></li>



            <li class="package-settment">
                <p class="discount"></p>
                <p class="total">
                    <!--id="ship_fee"-->
                    <?php if($orderItem['ship_fee_status'] != 1): ?><span >(含运费<em><?php echo (number_format($orderItem['ship_fee'], 2, '.', '')); ?></em>元)</span><span><label>合计:</label>
                     <?php else: ?>
                        <span >(订单免运费)</span><span><label>合计:</label><?php endif; ?>
                    <!--id="local_total"-->
                     <label  class="package-total" data-costitem="<?php echo (number_format($orderItem['lp_fee'], 2, '.', '')); ?>"   data-weight="<?php echo ($orderItem['total_weight']); ?>" data-final="<?php echo (number_format($orderItem['local_total'], 2, '.', '')); ?>">￥<?php echo (number_format($orderItem['local_total'], 2, '.', '')); ?></label>
                </span>
                </p>

            </li>




        </ul>
    </div>

           <?php else: ?>

      <div class="order-package mgTop" data-total="<?php echo (number_format($orderItem['local_total'], 2, '.', '')); ?>" data-fee="<?php echo ($orderItem['ship_fee']); ?>" data-free="<?php echo ($orderItem['free']); ?>">
          <?php if(!empty($orderItem['coupon'])): ?><div style="display: none" class="coupondis">
                  <?php if(is_array($orderItem['coupon'])): $i = 0; $__LIST__ = $orderItem['coupon'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$orderCoupon): $mod = ($i % 2 );++$i; if($orderCoupon['Is_use'] == 1): ?><li  data-id="<?php echo ($orderCoupon['code']); ?>" <?php if($orderCoupon['Ispaita'] == 1): ?>class='only'<?php endif; ?> data-lid="<?php echo ($orderCoupon['local_id']); ?>" data-money="<?php echo ($orderCoupon['discmoney']); ?>" data-tomoney="<?php echo ($orderCoupon['to_money']); ?>" data-did="<?php echo ($orderCoupon['id']); ?>"><?php echo ($orderCoupon['name']); ?></li><?php endif; endforeach; endif; else: echo "" ;endif; ?>
              </div><?php endif; ?>
          <div class="package-name clearfix" data-lid="<?php echo ($orderItem['local_id']); ?>" data-m="<?php echo ($orderItem['mobile']); ?>">
              <h3 class="fl">包裹<?php echo ($orderItem['inum']); ?></h3>
              <h5 class="fr"><?php if($orderItem['area_start'] != ''): echo ($orderItem['area_start']); ?>始发·<?php endif; echo ($orderItem['local_name']); ?></h5>
          </div>
          <ul>
              <li>

                  <?php if(is_array($orderItem["products"])): $i = 0; $__LIST__ = $orderItem["products"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$item): $mod = ($i % 2 );++$i; if($item['type'] != 1 and $item['ischeck'] == 1 and $item['active_ident'] == 1): ?><div class="goods-item clearfix" data-type="<?php echo ($item['type']); ?>" data-pid="<?php echo ($item['product_id']); ?>" data-lid="<?php echo ($item['local_id']); ?>">
                              <div class="img"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="<?php echo (getthumb($item["goods_id"])); ?>"></div>
                              <div class="goods-text">
                                  <p class="name text-hide"><?php echo ($item['name']); ?></p>
                                  <p class="norms"><?php echo ($item['spec_info']); ?></p>
                                  <p class="price clearfix">
                    <span class="fl"><label>￥</label>
                        <!--id="data_price"-->
    <label class="data_price" style="color: #da3558;"><?php echo (number_format($item['final_price'], 2, '.', '')); ?></label>
                        <label></label>
                    </span>
                                      <span class="fr"><?php echo ($item['cart_num']); ?></span>
                                  </p>
                              </div>
                          </div>
                          <?php else: ?>
                          <?php if(is_array($item["group_products"])): $i = 0; $__LIST__ = $item["group_products"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$gitem): $mod = ($i % 2 );++$i; if($item['active_ident'] == 1 and $item['ischeck'] == 1): ?><div class="goods-item clearfix  group" data-gid="<?php echo ($item['group_id']); ?>" data-type="<?php echo ($item['type']); ?>" data-pid="<?php echo ($gitem['product_id']); ?>"
                                       data-lid="<?php echo ($item['local_id']); ?>">
                                      <div class="img"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="<?php echo (getthumb($gitem["goods_id"])); ?>"></div>
                                      <div class="goods-text">
                                          <p class="name text-hide"><?php echo ($gitem['product_name']); ?></p>
                                          <!--id="is_spec_info"-->
                                          <p class="norms"  class="is_spec_info"><?php echo ($gitem['spec_info']); ?></p>
                                          <!--id="pack_id"-->

                                          <p class="price clearfix">
                                              <!--id="data_price"-->

                                              <span  class="pack_id" style="color: #ff2e49; font-size: 0.26rem"><?php echo ($gitem['name']); ?> 总价：<?php echo (number_format($gitem['total_price'], 2, '.', '')); ?></span>


                                              <span class="fr"><?php echo ($gitem['num']); ?></span>
                                          </p>
                                      </div>
                                  </div><?php endif; endforeach; endif; else: echo "" ;endif; endif; endforeach; endif; else: echo "" ;endif; ?>

              </li>

              <?php if($orderItem['is_self'] == 1): ?><li class="message">
                  <p class="fl">进口税</p>
                  <p class="fr red">￥<?php echo (number_format($orderItem['import_duty'], 2, '.', '')); ?></p>
              </li><?php endif; ?>

              <?php if($orderItem['tc_num'] != ''): ?><li class="message">
                      <p class="fl">套餐数量</p>
                      <p class="fr"><?php echo ($orderItem['tc_num']); ?>套</p>
                  </li><?php endif; ?>


              <li class="delivery">
                  <p class="fl">配送方式</p>
                  <?php if($orderItem['shipping'] == 1): ?><p class="fr logistic-method" data-id="<?php echo ($orderItem['shipping']); ?>">送货上门</p>
                      <p class="fr expect-time"><?php echo ($orderItem['expected_time']); ?></p>
                      <?php elseif($orderItem["shipping"] == 2): ?>
                      <p class="fr logistic-method" data-id="<?php echo ($orderItem['shipping']); ?>">自提</p>
                      <p class="fr expect-time"><?php echo ($orderItem['expected_time']); ?></p>
                      <p class="clearfix"></p>
                      <p class="zt-address" style="display:block">自提地址：<?php echo ($orderItem['zT_addr']); ?></p><?php endif; ?>


              </li>





              <?php if(!empty($orderItem['coupon'])): ?><li class="coupon-use clearfix">
                      <h3>使用礼券</h3>
                      <a href="javascript:void(0);">请选择</a>
                  </li><?php endif; ?>

              <?php if(!empty($orderItem['order_pro'])): ?><!-- 促销方式 -->
                  <li class="message" style="line-height: inherit;">
                      <p class="fl">促销方式</p>
                      <p class="fr">
                          <?php if(is_array($orderItem['order_pro'])): $i = 0; $__LIST__ = $orderItem['order_pro'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$order_pro): $mod = ($i % 2 );++$i;?><span class="red"><?php echo ($order_pro['name']); ?></span>
                              <br style="height: 1px"><?php endforeach; endif; else: echo "" ;endif; ?>
                      </p>
                  </li><?php endif; ?>

              <li class="message">
                  <!--id="msg"-->
                  <p class="fl">备注留言</p><p class="fr"><input type="text"  class="package-msg" value="" placeholder="选填:对本次交易的说明(建议写清楚自己的.....)"></p></li>



              <li class="package-settment">
                  <p class="discount"></p>
                  <p class="total">
                      <!--id="ship_fee"-->
                      <?php if($orderItem['ship_fee_status'] != 1): ?><span >(含运费<em><?php echo (number_format($orderItem['ship_fee'], 2, '.', '')); ?></em>元)</span><span><label>合计:</label>
             <?php else: ?>
                <span >(订单免运费)</span><span><label>合计:</label><?php endif; ?>
                      <!--id="local_total"-->
                      <label  class="package-total" data-costitem="<?php echo (number_format($orderItem['lp_fee'], 2, '.', '')); ?>"   data-weight="<?php echo ($orderItem['total_weight']); ?>" data-final="<?php echo (number_format($orderItem['local_total'], 2, '.', '')); ?>">￥<?php echo (number_format($orderItem['local_total'], 2, '.', '')); ?></label>
                      </span>
                  </p>

              </li>




          </ul>
      </div><?php endif; endif; endforeach; endif; else: echo "" ;endif; ?>
    <!-- 支付方式 -->
    <div class="pay-method mgTop">
        <h3>支付方式</h3>
        <ul>
            <li class="active"><img src="/Public/Home/images/wx-pay.png" alt=""><span data-id="1">微信支付</span></li>
          <!-- <li><img src="/Public/Home/images/yzf-pay.png" alt=""><span data-id="2">翼支付</span></li>
            <li><img src="/Public/Home/images/kq-pay.png" alt=""><span data-id="3">快钱支付</span></li>-->
           <!-- <li><img src="/Public/Home/images/yijifu-pay.png" alt=""><span data-id="4">易极付</span></li>-->
        </ul>
    </div>
    <div class="order-all-favours mgTop">
        <ul>
            <li><p class="fl">商品优惠</p><p class="fr">￥<?php echo (number_format($total['save'], 2, '.', '')); ?></p></li>
            <?php if($total['disOrderMoney'] != 0): ?><li><p class="fl">订单优惠</p><p class="fr">￥<?php echo (number_format($total['disOrderMoney'], 2, '.', '')); ?></p></li><?php endif; ?>
            <?php if($total['coupon'] != 0): ?><li><p class="fl">赠送</p><p class="fr"><?php echo ($total['coupon']); ?>张优惠券</p></li><?php endif; ?>
            <li><p class="fl">礼券抵扣</p><p class="fr" id="lj_real_discount">￥0.00</p></li>
            <li><p class="fl">奖金抵扣</p><p class="fr" id="jj_dknum">￥0.00</p></li>
            <li><p class="fl">运费</p><p class="fr">￥<?php echo (number_format($total['ship_fee'], 2, '.', '')); ?></p></li>
        </ul>
    </div>
</div>
<!-- 结算信息 -->
<div class="order-settment mgTop">
     <p class="fl"><label>应付金额:</label>&nbsp;<label id="last_price" data-all="<?php echo (number_format($total['total_fee'], 2, '.', '')); ?>">¥<?php echo (number_format($total['total_fee'], 2, '.', '')); ?></label></p>
     <a href="javascript:void(0);" class="order-settment-btn">结算</a>
</div>
<!-- 优惠券弹窗 -->
<div class="coupon-tips">
    <a href="javascript:void(0);" class="close"></a>
    <h2>店铺礼券</h2>
    <ul></ul>
    <a href="javascript:void(0);" class="btn btn-block btn-second angle">确定</a>
</div>
<script type="text/javascript">
    require(['cart/order']);
    $(function () {
        var rnumber = Math.floor(Math.random()*1000);
        history.replaceState({mod: rnumber}, 'Title', '?mod='+rnumber);

        $.ajax({
            url:"<?php echo U('Carts/isBuyOk/');?>",
            datatype:'json',
            success:function(data){
                if(data['status']==1){
                    window.location.href = data.url;
                }
            },
            error:function(){
                _global.promote.alertPopup("服务器异常，请稍后尝试！");
            }
        })
    })

</script>
</body>
</html>